package com.education.cms.dto.clock;

import com.education.cms.utils.DateUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.ParseException;
import java.util.Date;

public class ComplexSearchDto {
    private Integer userId;
    @DateTimeFormat(pattern = "yyyy-MM-DD")
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-DD")
    private Date endDate;
    private Integer status;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Date getBeginDate() throws ParseException {
        if (beginDate == null){
            return null;
        }else
        return DateUtils.dateNoTime(beginDate);
    }

    public void setBeginDate(Date beginDate) {
        this.beginDate = beginDate;
    }

    public Date getEndDate() throws ParseException {
        if (endDate == null){
            return null;
        }else
        return DateUtils.dateFullTime(endDate);
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

}
